package com.poi.action;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 连接数据库
 * @author PCCW
 *
 */
public class DBUtil {
	Connection conn = null;
	public Connection getConn() {
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
			conn = DriverManager
					.getConnection(
							"jdbc:sqlserver://localhost:1433;databaseName=POS_DB",
							"sa", "hzau#fish#huang*sun*ljx*2016");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	}

	public static void main(String[] args){
		DBUtil  dbutil = new DBUtil();
		dbutil.getConn();		
	}
	
}
